<template>
  <div class="beij">
    <div class="beijing">
      <div class="tobu">
        <div class="img" @click="fanh">
          <img src="../assets/fh3.png" alt="" />
        </div>
        <div class="text">
          <span> {{ datas.orderInfo.orderStatusText }}</span>
        </div>
        <div class="img">
          <img src="../assets/gd2.png" alt="" />
        </div>
      </div>

      <div class="xiangqing">
        <ul>
          <li>
            <div class="img">
              <img src="../assets/dsh.png" alt="" />
            </div>
          </li>
          <li>
            <div class="text">
              <span>{{ datas.orderInfo.orderStatusText }}</span>
              <span>商品已经到达【广西南宁市】</span>
            </div>
          </li>
          <li>
            <span class="chala">查看物流</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="dizhi">
      <ul>
        <li>
          <div class="img">
            <img src="../assets/das.png" alt="" />
          </div>
        </li>
        <li>
          <div>
            <span>
              {{ datas.orderInfo.consignee }}
            </span>
            <span>
              {{ datas.orderInfo.mobile }}
            </span>
          </div>
          <div>
            <span> {{ datas.orderInfo.address }}</span>
          </div>
        </li>
      </ul>
    </div>

    <div class="monn">
      <div style="height: 10px; margin-top: 10px"></div>
      <div class="danhao">
        <span>单号：{{ datas.orderInfo.orderSn }}</span>
      </div>
      <div class="cshangp">
        <ul
          v-for="(item, index) in datas.orderGoods"
          :key="index"
          @click="toxiangqi(item.goodsId)"
        >
          <li>
            <div class="imgs">
              <img :src="item.picUrl" alt="" />
            </div>
          </li>
          <li>
            <span class="texly">{{ item.goodsName }}</span>
            <div class="guig">
              <span v-for="(t, i) in item.specifications" :key="i">
                {{ t }}
              </span>
            </div>
            <div class="jiage">
              <span>总价：</span
              ><span style="color: rgb(233, 106, 106)">{{ item.price }}</span>
            </div>
          </li>
          <li>
            <div>
              <span>{{ item.price }}</span> <span>￥</span>
            </div>
            <div>
              <span>*{{ item.number }}</span>
            </div>
            <div><span>0</span> <span>优惠：</span></div>
            <div class="mnas">
              <span>￥{{ item.price }}</span> <span>实付款:</span>
            </div>
          </li>
        </ul>
      </div>
    </div>

    <ul class="dibu">
      <li>
        <span>更多</span>
      </li>
      <li><span> 延长收货 </span></li>
      <li><span>察看物流</span></li>
    </ul>
  </div>
</template>

<script>
import API from "../http/API";
export default {
  name: "OrderDetails",
  data() {
    return {
      datas: [],
    };
  },
  watch: {
    $route: {
      handler(to) {
        console.log(to);
        if (to.path == "/orderdetails") {
          this.http(to.query.id); //查询数据
        }
      },
    },
  },
  created() {
    this.http(this.$route.query.id);
  },

  methods: {
    http(e) {
      this.$get(API.GET_ORDER_DETAIL, {
        orderId: e,
        token: this.$store.state.token,
      }).then((res) => {
        console.log(res);
        this.datas = res.data;
      });
    },
    fanh() {
      this.$router.go(-1);
    },
    toxiangqi(e) {
      this.$router.push({
        path: "/details",

        query: { userId: e },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.beij {
  height: 100%;
  background-color: rgb(243, 243, 243);

  .beijing {
    height: 150px;
    //   border: 1px solid #000;
    background-image: linear-gradient(
      to left,
      rgb(226, 108, 108),
      rgb(206, 212, 112)
    );
    .xiangqing {
      margin-left: 10px;
      margin-right: 10px;
      background-color: rgb(255, 255, 255);
      border-radius: 5px;
      height: 80px;
      display: flex;
      align-items: center;
      ul {
        margin-left: 5px;
        margin-right: 5px;
        display: flex;
        height: 80%;
        width: 100%;
        li {
          // border: 1px solid #000;
          &:nth-child(1) {
            display: flex;
            align-items: center;
            width: 50px;
            .img {
              width: 50px;
              height: 50px;
              //   border: 1px solid #000;
              img {
                width: 100%;
                height: 100%;
              }
            }
          }
          &:nth-child(2) {
            flex: 1;
            display: flex;
            flex-direction: column;
            margin-left: 10px;
            justify-content: center;
            .text {
              display: flex;
              flex-direction: column;
              height: 40px;

              justify-content: space-between;
              //  border: 1px solid #000;
              span {
                &:nth-child(1) {
                  font-size: 17px;
                  color: rgb(49, 49, 49);
                }
                &:nth-child(2) {
                  font-size: 15px;
                  color: rgb(173, 173, 173);
                }
              }
            }
          }
          &:nth-child(3) {
            width: 80px;
            display: flex;
            align-items: center;
            justify-content: center;
            span {
              color: rgb(131, 130, 130);
              padding: 10px 10px 10px 10px;
              border-radius: 5px;
              border: 1px solid rgb(145, 145, 145);
            }
          }
        }
      }
    }
    .tobu {
      height: 50px;
      // border: 1px solid #000;
      margin-left: 10px;
      margin-right: 10px;
      display: flex;
      align-items: center;
      .img {
        width: 25px;
        height: 25px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .text {
        flex: 1;
        color: rgb(255, 255, 255);
        font-size: 17px;
        text-align: center;
      }
    }
  }
  .dizhi {
    background-color: rgb(255, 255, 255);
    height: 100px;
    display: flex;
    align-items: center;
    ul {
      margin-left: 10px;
      margin-right: 10px;
      height: 70px;
      width: 100%;
      //   border: 1px solid #000;
      display: flex;
      li {
        height: 100%;
        display: flex;

        &:nth-child(1) {
          width: 50px;
          //   border: 1px solid #000;
          align-items: center;
          .img {
            width: 50px;
            height: 50px;
            img {
              width: 100%;
              height: 100%;
            }
          }
        }
        &:nth-child(2) {
          width: 50px;
          flex: 1;
          //   border: 1px solid #000;
          margin-left: 10px;
          flex-direction: column;
          justify-content: center;
          div {
            &:nth-child(1) {
              height: 20px;
              //   border: 1px solid #000;
              line-height: 20px;
              font-size: 16px;
              color: rgb(68, 68, 68);
              margin-bottom: 5px;
              span {
                &:nth-child(2) {
                  color: rgb(185, 182, 182);
                }
              }
            }
            &:nth-child(2) {
              //   height: 20px;
              //   border: 1px solid #000;
              line-height: 20px;
              font-size: 15px;
              color: rgb(68, 68, 68);
              margin-right: 5px;
            }
          }
        }
      }
    }
  }
  .monn {
    background-color: rgb(255, 255, 255);
    .danhao {
      margin-left: 10px;
      margin-right: 10px;
      height: 20px;
      display: flex;
      align-items: center;
      span {
      }
    }
    .cshangp {
      height: 120px;

      display: flex;
      align-items: center;
      ul {
        display: flex;
        margin-left: 10px;
        margin-right: 10px;
        width: 100%;
        li {
          &:nth-child(1) {
            width: 90px;
            height: 90px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 5px;
            background-color: rgb(224, 229, 233);
            .imgs {
              width: 80px;
              height: 80px;
              img {
                width: 100%;
                height: 100%;
              }
            }
          }
          &:nth-child(2) {
            flex: 1;
            margin-left: 10px;
            .texly {
              font-size: 17px;
            }
            .guig {
              margin-top: 10px;
              span {
                background-color: rgb(233, 233, 233);
                padding: 5px 5px 5px 5px;
                border-radius: 5px;
              }
            }
            .jiage {
              margin-top: 10px;
              height: 30px;
              display: flex;
              align-items: center;
              //   border: 1px solid #000;
              font-size: 16px;
              color: rgb(44, 44, 44);
            }
          }
          &:nth-child(3) {
            //   width: 50px;
            display: flex;
            flex-direction: column;
            div {
              display: flex;
              flex-direction: row-reverse;
              margin-bottom: 10px;
              &:nth-child(1) {
                font-size: 16px;
              }
            }
            .mnas {
              // width: 100px;
              height: 20px;
              //   border: 1px solid #000;
              line-height: 20px;
              span {
                margin-left: 5px;
                font-size: 16px;
                &:nth-child(1) {
                  color: rgb(236, 119, 119);
                }
              }
            }
          }
        }
      }
    }
  }
  .dibu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: rgb(253, 253, 253);
    display: flex;
    align-items: center;
    li {
      height: 30px;
      margin-left: 5px;
      margin-right: 5px;
      border-radius: 20px;
      display: flex;
      align-items: center;
      //   border: 1px solid #000;
      &:nth-child(1) {
        color: rgb(167, 167, 167);
        flex: 1;
        span {
          font-size: 16px;
        }
      }
      &:nth-child(2) {
        display: flex;
        justify-content: center;
        color: rgb(63, 61, 61);
        width: 70px;
        border: 1px solid rgb(146, 146, 146);
      }
      &:nth-child(3) {
        display: flex;
        justify-content: center;
        color: rgb(63, 61, 61);
        width: 70px;
        border: 1px solid rgb(146, 146, 146);
      }
    }
  }
}
</style>